<?php
class BannerWidget extends CWidget{
    
    public $object;
    public $type;
    
    public function run() {
        parent::run();
        $model = new Banner();
        $model->object = $this->object;
        $model->type = $this->type;
        //get all banner
        $criteria = new CDbCriteria();
        $criteria->addCondition("object=:object");
        $criteria->addCondition("type=:type");
        $criteria->order = 'area ASC,orders ASC';
        $criteria->params = array(':object' => $this->object,':type' => $this->type);
        $banners = Banner::model()->findAll($criteria);
        $this->render('addBanner',array('type' => $this->type,'object' => $this->object,'model' => $model,'banners' => $banners));
    }
}
